//
//  AddStoreRequest.m
//  NPS
//
//  Created by jadd on 15/10/20.
//  Copyright © 2015年 jadd. All rights reserved.
//

#import "AddStoreRequest.h"
@interface AddStoreRequest()
@property (nonatomic) NSString * name;
@property (nonatomic) NSString *userId;
@end


@implementation AddStoreRequest
-(instancetype)initWithUserId:(NSString*)userId Name:(NSString *)name;
{
    self = [super init];
    if (self) {
        self.name = name;
        self.userId = userId;
    }
    return self;
    
}


- (NSString *)getRequestURL {
    NSString *jsonString= [Config generateStringToJson:[self getRequestParams]];
    NSString *s = [Config GTMEncodeTest:jsonString];
    NSString *accesskey = [Config getAccess_key];
    NSString *appendString = [[NSString alloc] initWithFormat:@"%@%@",s, accesskey];
    NSString *v = [Config md5:appendString];
    //NSString *md5 = [Config md5:accesskey];
    NSString * baseUrl = [super getRequestURL];
    NSString *url = [NSString stringWithFormat:@"%@%@/?s=%@&v=%@",baseUrl, API_AddStore, s,v];
    return url;
}
- (RequestMethodType)getRequestMethod {
    return PostMethod;
}

- (id)getRequestParams {
    NSMutableDictionary * paramDict = [super getRequestParams];
    if (self.name) {
        [paramDict setObject:self.name forKeyedSubscript:@"name"];
    }
    if (self.userId) {
        [paramDict setObject:self.userId forKeyedSubscript:@"user_id"];
    }
    return paramDict;
}
@end
